package com.nengchuan.eic.nceconomy.constant;

import java.util.stream.Stream;

/**
 * @description: 单位分类排序Enum
 * @author: pan wen
 * @create: 2020/05/20 10:07
 * @version：1.0.0
 */
public enum OrgCategorySortEnum {
    CONSTRUCTION_MANAGEMENT("建管单位",9),
    PROVINCE_COMPANY("省公司",8),
    SUPERVISOR("监理单位",7),
    DESIGN("设计单位",6),
    DESIGN_REVIEW("设计评审单位",5),
    REVIEW("评审单位",4),
    CONSTRUCTIO("施工单位",3),
    SUBPACKAGE("分包单位",2),
    SUPPORT("支撑单位",1),
    COMMON("",0); //通用排序不含业务关系

    //单位名称
    public String name;

    //排序权重
    public int sort;

    OrgCategorySortEnum(String name, int sort) {
        this.name = name;
        this.sort = sort;
    }

    /**
     * 根据名称获取排序
     * @param name
     * @return
     */
    public static int getSortByName(String name){
        return Stream.of(OrgCategorySortEnum.values()).filter(e->e.name.equals(name)).findFirst().orElse(COMMON).sort;
    }
}
